<?php
class Content_Form_PageEditing extends Zend_Form
{
    public function init()
    {
        $this->setMethod('post');

        $page = new Content_Model_Page();

        $definition = $page->getTable()->getColumnDefinition('title');
        $this->addElement('text', 'title', array(
            'label'      => 'Title',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('validator' => 'StringLength',
                      'options' => array(0, $definition['length']))
            )
        ));

        $this->addElement('textarea', 'body', array(
            'label'      => 'Body text',
            'required'   => true,
        ));

        $this->addElement('checkbox', 'active', array(
            'label'      => 'Active',
        ));
    
        $this->addElement('submit', 'submit', array(
            'label'    => 'Save',
        ));
    }
}
